package rekursion;

public class Reks{
  public static void main(String[] args){
    System.out.println("1. Versuch");
    rek1(5);
    //System.out.println("\n2. Versuch");
    //rek2(5);
    //System.out.println("\n3. Versuch");
    //rek3(5);
    //System.out.println("\nEnde.");
    pos=2;//Integer.parseInt(args[0]);
    rek3mitNummer(5);
  }

  public static void rek1(int i){
    if(i<0) return;
    System.out.print(i+" ");
    rek1(i-1);
  }

  public static void rek2(int i){
    if(i<0) return;
    rek2(i-1);
    System.out.print(i+" ");
  }

  public static void rek3(int i){
    if(i<0) return;
    rek3(i-1);
    System.out.print(i+" ");
    rek3(i-1);
  }

  public static int pos;
  public static void rek3mitNummer(int i){
    if(i<0) return;
    rek3mitNummer(i-1);
    if(pos--==0) System.out.println(i);
    rek3mitNummer(i-1);
  }
}
